﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Weibo4SharpWeb.Controllers
{
    public class UserController : WeiboControllerBase
    {
        //
        // GET: /User/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Fans(int id = -1)
        {
            var fans = GetAuthenticatedService().ListFollowers(id);

            if (fans.NextCursor != null && fans.NextCursor != 0)
            {
                ViewBag.Next = fans.NextCursor;
            }
            if (fans.PreviousCursor != null && id != -1)
            {
                ViewBag.Prev = id - 20 == 0 ? -1 : id - 20;                
            }

            if (id == -1)
            {
                GetAuthenticatedService().ResetCount(4);
            }

            if (Request.IsAjaxRequest())
            {
                return PartialView("FansList", fans);
            }

            return View(fans);
        }

        public ActionResult RemoveZombie()
        {
            return View();
        }       
    }
}
